﻿using System;

using System.Collections.Generic;
using System.Text;
using Silvermoon.Controls.Classes;
using System.Drawing;
using Silvermoon.Core;
using Silvermoon.Animations;
using Silvermoon.Controls.Utils;

namespace Silvermoon.Controls
{
    /// <summary>
    /// Control to provide context menu.
    /// </summary>
    public class ContextMenu : Menu
    {

        public ContextMenu()
            : base()
        {
            MenuPosition = MenuPosition.Left ;
        }

        /// <summary>
        /// Gets or sets the menu position relative to an anchor control.
        /// </summary>
        /// <value>The menu position.</value>
        public MenuPosition MenuPosition { get; set; }

        /// <summary>
        /// Opens the context menu relative to the specified control.
        /// </summary>
        /// <param name="anchor">The control where the menu is opened relative to it's position.</param>
        public virtual void Show(Control anchor)
        {
            Height = 0;
            PreLoad();
            Bounds = ContextMenuUtil.GetMenuBounds(this, anchor);
            TransitionMode mode = ContextMenuUtil.GetTransitionMode(this, anchor);
            Show(mode);
        }



    }
}
